package com.hsh.tools.decision;

import cn.hutool.core.util.StrUtil;
import com.hsh.tools.StrUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * <p>
 * </p>
 *
 * @author 黄思海
 * @date 2021/6/26 21:15
 */
@Getter
@AllArgsConstructor
public enum LoginTypEnums {
    LOGIN_MOBILE_PASSWORD("phonePassword", "手机号密码登录"),
    LOGIN_USERNAME_PASSWORD("usernamePassword", "用户名密码登录"),
    LOGIN_FACE("face", "人脸登录"),
    LOGIN_MOBILE_VERITY_CODE("verityCode", "手机验证码登录"),
    LOGIN_EMAIL("email", "邮箱登录");

    private final String code;

    private final String desc;

    public static LoginTypEnums parseCode(String code) {
        if (StrUtils.isEmpty(code)) {
            return null;
        }
        for (LoginTypEnums item : LoginTypEnums.values()) {
            if (item.getCode().equalsIgnoreCase(code)) {
                return item;
            }
        }
        return null;
    }

}
